package com.geyue.controller;

import com.geyue.common.toolbox.result.Res;
import com.geyue.core.model.Help;
import com.geyue.core.model.Teacher;
import com.geyue.core.service.HelpService;
import com.geyue.core.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Chen on 2017/4/20.
 */
@RestController
@RequestMapping("/api/system")
public class SystemController {

    @Autowired
    private HelpService helpService;

    @RequestMapping(value = "/all",method = RequestMethod.GET)
    public Object all(){

        return helpService.queryAll();
    }

    @RequestMapping(value = "/page",method = RequestMethod.GET)
    @ResponseBody
    public Res list(Integer pageSize, Integer pageNum){

        return Res.success("",helpService.getPage(pageNum,pageSize,new Help()));
    }

    /**
     * 保存添加的帮助与反馈
     * @param help
     * @return
     */
    @RequestMapping(value = "/saveHelp",method = RequestMethod.GET)
    @ResponseBody
    public int saveHelp(Help help){

        return helpService.save(help);
    }

}
